{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2024-09-18T13:42:24.533777Z",
     "start_time": "2024-09-18T13:42:23.637665Z"
    }
   },
   "source": [
    "#0.8055\n",
    "import pandas as p\n",
    "import numpy as n\n",
    "import xgboost as xgb"
   ],
   "outputs": [],
   "execution_count": 1
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-09-18T13:48:39.125545Z",
     "start_time": "2024-09-18T13:43:12.740243Z"
    }
   },
   "cell_type": "code",
   "source": [
    "\n",
    "def prepr(raw):\n",
    "    pre=raw.copy()\n",
    "    pre['num']=1\n",
    "    #折扣率\n",
    "    pre['MJ']=list(map(lambda x:1 if':'in str(x) else 0 ,pre['Discount_rate']))\n",
    "    pre['JIAN']=list(map(lambda x:int(str(x).split(':')[1]) if\":\"in repr(x) else 0,pre['Discount_rate']))\n",
    "    pre['MI_COST']=list(map(lambda x:int(str(x).split(':')[0]) if\":\"in repr(x) else 0,pre['Discount_rate']))\n",
    "    pre['DISCOUNT']=list(map(lambda x:(float(str(x).split(':')[0])-float(str(x).split(':')[1]))/float(str(x).split(':')[0]) if\":\"in repr(x) else float(x),pre['Discount_rate']))\n",
    "    #距离\n",
    "    pre['Distance'].fillna(-1,inplace=True)\n",
    "    pre['NUII_DISTANCE']=pre['Distance'].map(lambda x:1 if x == -1 else 0)\n",
    "    #时间\n",
    "    pre['DATE_RECEIVED']=p.to_datetime(pre['Date_received'],format='%Y%m%d')\n",
    "    if'Date' in pre.columns.tolist():\n",
    "        pre['DATE']=p.to_datetime(pre['Date'],format='%Y%m%d')\n",
    "        pre['label'] = list(map(lambda y,x: 1 if (y-x).total_seconds()/(24*3600) <= 15 else 0,pre['DATE_RECEIVED'],pre['DATE']))\n",
    "        pre['label'] = pre['label'].map(int)\n",
    "    return pre\n",
    "\n",
    "def construct_data(history,label):\n",
    "    label_f=get_label_f(label)\n",
    "    history_f=get_history_f(history,label)\n",
    "    #构造数据集\n",
    "    commom=list(set(label_f.columns.tolist())&set(history_f.columns.tolist()))\n",
    "    data=p.concat([label_f, history_f.drop(commom, axis=1)],axis=1)\n",
    "    #去重\n",
    "    data.drop_duplicates(subset=None,keep='last',inplace=True)\n",
    "    data.index=range(len(data))\n",
    "    return data\n",
    "def get_history_f(history,label):\n",
    "    data=history.copy()\n",
    "    data['Coupon_id']=data['Coupon_id'].map(int)\n",
    "    data['Date_received']=data['Date_received'].map(int)\n",
    "    h_f=label.copy()\n",
    "    ###########################      用户\n",
    "    keys=['User_id']\n",
    "    prefixs='history_field_'+'_'.join(keys)+'_'\n",
    "    #用户领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #用户核销数\n",
    "    pivot=p.DataFrame(data[data['Date'].map(lambda x : str(x) !='nan')].pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received_use'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #用户核销率\n",
    "    h_f[prefixs + 'lu_use'] = list(map(lambda x,y: x/y if y!=0 else 0 ,h_f[prefixs + 'received_use'],h_f[prefixs + 'received']))\n",
    "    #用户  领满减数\n",
    "    pivot=p.DataFrame(data[data['MJ']==1].pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'MJ'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #用户领满减率\n",
    "    h_f[prefixs + 'lu_MJ'] = list(map(lambda x,y: x/y if y!=0 else 0 ,h_f[prefixs + 'MJ'],h_f[prefixs + 'received']))\n",
    "    \n",
    "    \n",
    "    #用户15天内核销最大折扣率\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = max)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_max'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how ='left')\n",
    "    #用户15天内核销最小折扣率\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = min)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_min'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how ='left')\n",
    "    #用户15天内核销平均折扣率\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.mean)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_aver'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how ='left')\n",
    "    #用户15天内核销中位折扣率\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.median)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_median'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how ='left')\n",
    "    #用户15天内核销的最大距离\n",
    "    pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = max)).rename(columns = {'Distance':prefixs + 'Distance_15_max'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, how ='left', on = keys)\n",
    "    #用户15天内核销的最小距离\n",
    "    pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = min)).rename(columns = {'Distance':prefixs + 'Distance_15_min'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, how ='left', on = keys)\n",
    "    #用户15天内核销的平均距离\n",
    "    pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.mean)).rename(columns = {'Distance':prefixs + 'Distance_15_mean'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, how ='left', on = keys)\n",
    "    #用户15天内核销的中位距离\n",
    "    pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.median)).rename(columns = {'Distance':prefixs + 'Distance_15_median'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, how ='left', on = keys)\n",
    "    #用户15天内核销满减券减额最大值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #用户15天内核销满减券减额最小值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #用户15天内核销满减券减额平均值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #用户15天内核销满减券减额中位值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #用户15天内核销满减券最低消费最大值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #用户15天内核销满减券最低消费最小值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #用户15天内核销满减券最低消费平均值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #用户15天内核销满减券最低消费中位值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_medain'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    \n",
    "    #################################         用户+商家\n",
    "    keys=['User_id','Merchant_id']\n",
    "    prefixs='history_field_'+'_'.join(keys)+'_'\n",
    "    #用户+商家领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #用户+商家核销数\n",
    "    pivot=p.DataFrame(data[data['Date'].map(lambda x : str(x) !='nan')].pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received_use'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #用户+商家核销率\n",
    "    h_f[prefixs + 'lu_use'] = list(map(lambda x,y: x/y if y!=0 else 0 ,h_f[prefixs + 'received_use'],h_f[prefixs + 'received']))\n",
    "    \n",
    "    #用户+商家15天内核销最大折扣率\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = max)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_max'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how ='left')\n",
    "    #用户+商家15天内核销最小折扣率\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = min)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_min'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how ='left')\n",
    "    #用户+商家15天内核销平均折扣率\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.mean)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_aver'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how ='left')\n",
    "    #用户+商家15天内核销中位折扣率\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.median)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_median'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how ='left')\n",
    "    #用户+商家15天内核销满减券减额最大值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #用户+商家15天内核销满减券减额最小值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #用户+商家15天内核销满减券减额平均值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #用户+商家15天内核销满减券减额中位值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #用户+商家15天内核销满减券最低消费最大值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #用户+商家15天内核销满减券最低消费最小值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #用户+商家15天内核销满减券最低消费平均值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #用户+商家15天内核销满减券最低消费中位值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_medain'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    \n",
    "    #################################           用户+优惠券\n",
    "    keys=['User_id','Coupon_id']\n",
    "    prefixs='history_field_'+'_'.join(keys)+'_'\n",
    "    #用户+优惠券领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #用户+优惠券核销数\n",
    "    pivot=p.DataFrame(data[data['Date'].map(lambda x : str(x) !='nan')].pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received_use'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #用户+优惠券核销率\n",
    "    h_f[prefixs + 'lu_use'] = list(map(lambda x,y: x/y if y!=0 else 0 ,h_f[prefixs + 'received_use'],h_f[prefixs + 'received']))\n",
    "    #################################             用户+折扣率\n",
    "    keys=['User_id','DISCOUNT']\n",
    "    prefixs='history_field_'+'_'.join(keys)+'_'\n",
    "    #用户+折扣率 领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #用户+折扣率 核销数\n",
    "    pivot=p.DataFrame(data[data['Date'].map(lambda x:str(x) !='nan')].pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received_use'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #用户+折扣率 核销率\n",
    "    h_f[prefixs + 'lu_use'] = list(map(lambda x,y: x/y if y!=0 else 0 ,h_f[prefixs + 'received_use'],h_f[prefixs + 'received']))\n",
    "    \n",
    "    #################################            用户+日期\n",
    "    keys=['User_id','DATE_RECEIVED']\n",
    "    prefixs='history_field_'+'_'.join(keys)+'_'\n",
    "    #用户+日期领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #用户+日期核销数\n",
    "    pivot=p.DataFrame(data[data['Date'].map(lambda x : str(x) !='nan')].pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received_use'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #用户+日期核销率\n",
    "    h_f[prefixs + 'lu_use'] = list(map(lambda x,y: x/y if y!=0 else 0 ,h_f[prefixs + 'received_use'],h_f[prefixs + 'received']))\n",
    "    #################################                用户+商家+优惠券\n",
    "    keys=['User_id','Merchant_id','Coupon_id']\n",
    "    prefixs='history_field_'+'_'.join(keys)+'_'\n",
    "    #用户+商家+优惠券 领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #用户+商家+优惠券 核销数\n",
    "    pivot=p.DataFrame(data[data['Date'].map(lambda x : str(x) !='nan')].pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received_use'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #用户+商家+优惠券 核销率\n",
    "    h_f[prefixs + 'lu_use'] = list(map(lambda x,y: x/y if y!=0 else 0 ,h_f[prefixs + 'received_use'],h_f[prefixs + 'received']))\n",
    "    #################################                   用户+商家+日期\n",
    "    keys=['User_id','Merchant_id','DATE_RECEIVED']\n",
    "    prefixs='history_field_'+'_'.join(keys)+'_'\n",
    "    #  用户+商家+日期领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    # 用户+商家+日期 核销数\n",
    "    pivot=p.DataFrame(data[data['Date'].map(lambda x : str(x) !='nan')].pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received_use'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    # 用户+商家+日期 核销率\n",
    "    h_f[prefixs + 'lu_use'] = list(map(lambda x,y: x/y if y!=0 else 0 ,h_f[prefixs + 'received_use'],h_f[prefixs + 'received']))\n",
    "    #################################                   用户+优惠券+日期\n",
    "    keys=['User_id','Coupon_id','DATE_RECEIVED']\n",
    "    prefixs='history_field_'+'_'.join(keys)+'_'\n",
    "    #用户+优惠券+日期 领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #用户+优惠券+日期 核销数\n",
    "    pivot=p.DataFrame(data[data['Date'].map(lambda x : str(x) !='nan')].pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received_use'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #用户+优惠券+日期 核销率\n",
    "    h_f[prefixs + 'lu_use'] = list(map(lambda x,y: x/y if y!=0 else 0 ,h_f[prefixs + 'received_use'],h_f[prefixs + 'received']))\n",
    "    \n",
    "    #################################        商家\n",
    "    keys=['Merchant_id']\n",
    "    prefixs='history_field_'+'_'.join(keys)+'_'\n",
    "    #商家领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #商家核销数\n",
    "    pivot=p.DataFrame(data[data['Date'].map(lambda x : str(x) !='nan')].pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received_use'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #商家核销率\n",
    "    h_f[prefixs + 'lu_use'] = list(map(lambda x,y: x/y if y!=0 else 0 ,h_f[prefixs + 'received_use'],h_f[prefixs + 'received']))\n",
    "    #商家15天内核销的最大距离\n",
    "    pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = max)).rename(columns = {'Distance':prefixs + 'Distance_15_max'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, how ='left', on = keys)\n",
    "    #商家15天内核销的最小距离\n",
    "    pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = min)).rename(columns = {'Distance':prefixs + 'Distance_15_min'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, how ='left', on = keys)\n",
    "    #商家15天内核销的平均距离\n",
    "    pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.mean)).rename(columns = {'Distance':prefixs + 'Distance_15_aver'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, how ='left', on = keys)\n",
    "    #商家15天内核销的中位距离\n",
    "    pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.median)).rename(columns = {'Distance':prefixs + 'Distance_15_median'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, how ='left', on = keys)\n",
    "    #商家15天内核销最大折扣率\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = max)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_max'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how ='left')\n",
    "    #商家15天内核销最小折扣率\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = min)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_min'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how ='left')\n",
    "    #商家15天内核销平均折扣率\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.mean)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_aver'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how ='left')\n",
    "    #商家15天内核销中位折扣率\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.median)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_median'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how ='left')\n",
    "    #商家15天内核销满减券减额最大值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #商家15天内核销满减券减额最小值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #商家15天内核销满减券减额平均值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #商家15天内核销满减券减额中位值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #商家15天内核销满减券最低消费最大值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #商家15天内核销满减券最低消费最小值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #商家15天内核销满减券最低消费平均值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    #商家15天内核销满减券最低消费中位值\n",
    "    pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_medain'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, on = keys, how = 'left')\n",
    "    \n",
    "    #################################             商家+优惠券\n",
    "    keys=['Merchant_id','Coupon_id']\n",
    "    prefixs='history_field_'+'_'.join(keys)+'_'\n",
    "    #商家+优惠券领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #商家+优惠券核销数\n",
    "    pivot=p.DataFrame(data[data['Date'].map(lambda x:str(x) !='nan')].pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received_use'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #商家+优惠券核销率\n",
    "    h_f[prefixs + 'lu_use'] = list(map(lambda x,y: x/y if y!=0 else 0 ,h_f[prefixs + 'received_use'],h_f[prefixs + 'received']))\n",
    "    #################################             商家+折扣率\n",
    "    keys=['Merchant_id','DISCOUNT']\n",
    "    prefixs='history_field_'+'_'.join(keys)+'_'\n",
    "    #商家+折扣率领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #商家+折扣率核销数\n",
    "    pivot=p.DataFrame(data[data['Date'].map(lambda x:str(x) !='nan')].pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received_use'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #商家+折扣率核销率\n",
    "    h_f[prefixs + 'lu_use'] = list(map(lambda x,y: x/y if y!=0 else 0 ,h_f[prefixs + 'received_use'],h_f[prefixs + 'received']))\n",
    "    \n",
    "    #################################             商家+日期\n",
    "    keys=['Merchant_id','DATE_RECEIVED']\n",
    "    prefixs='history_field_'+'_'.join(keys)+'_'\n",
    "    #商家+日期领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #商家+日期核销数\n",
    "    pivot=p.DataFrame(data[data['Date'].map(lambda x:str(x) !='nan')].pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received_use'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #商家+日期核销率\n",
    "    h_f[prefixs + 'lu_use'] = list(map(lambda x,y: x/y if y!=0 else 0 ,h_f[prefixs + 'received_use'],h_f[prefixs + 'received']))\n",
    "    #################################             商家+优惠券+日期\n",
    "    keys=['Merchant_id','Coupon_id','DATE_RECEIVED']\n",
    "    prefixs='history_field_'+'_'.join(keys)+'_'\n",
    "    #商家+优惠券+日期 领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #商家+优惠券+日期核销数\n",
    "    pivot=p.DataFrame(data[data['Date'].map(lambda x:str(x) !='nan')].pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received_use'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #商家+优惠券+日期核销率\n",
    "    h_f[prefixs + 'lu_use'] = list(map(lambda x,y: x/y if y!=0 else 0 ,h_f[prefixs + 'received_use'],h_f[prefixs + 'received']))\n",
    "    \n",
    "    #################################               优惠券\n",
    "    keys=['Coupon_id']\n",
    "    prefixs='history_field_'+'_'.join(keys)+'_'\n",
    "    #优惠券领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #优惠券核销数\n",
    "    pivot=p.DataFrame(data[data['Date'].map(lambda x : str(x) !='nan')].pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received_use'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #优惠券核销率\n",
    "    h_f[prefixs + 'lu_use'] = list(map(lambda x,y: x/y if y!=0 else 0 ,h_f[prefixs + 'received_use'],h_f[prefixs + 'received']))\n",
    "    \n",
    "    #优惠券15天内核销的最大距离\n",
    "    pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = max)).rename(columns = {'Distance':prefixs + 'Distance_15_max'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, how ='left', on = keys)\n",
    "    #优惠券15天内核销的最小距离\n",
    "    pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = min)).rename(columns = {'Distance':prefixs + 'Distance_15_min'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, how ='left', on = keys)\n",
    "    #优惠券15天内核销的平均距离\n",
    "    pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.mean)).rename(columns = {'Distance':prefixs + 'Distance_15_mean'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, how ='left', on = keys)\n",
    "    #优惠券15天内核销的中位距离\n",
    "    pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.median)).rename(columns = {'Distance':prefixs + 'Distance_15_median'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, how ='left', on = keys)\n",
    "    #################################               优惠券+日期\n",
    "    keys=['Coupon_id','DATE_RECEIVED']\n",
    "    prefixs='history_field_'+'_'.join(keys)+'_'\n",
    "    #优惠券+日期领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #优惠券+日期核销数\n",
    "    pivot=p.DataFrame(data[data['Date'].map(lambda x : str(x) !='nan')].pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received_use'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #优惠券+日期核销率\n",
    "    h_f[prefixs + 'lu_use'] = list(map(lambda x,y: x/y if y!=0 else 0 ,h_f[prefixs + 'received_use'],h_f[prefixs + 'received']))\n",
    "    \n",
    "    #################################             折扣率\n",
    "    keys=['DISCOUNT']\n",
    "    prefixs='history_field_'+'_'.join(keys)+'_'\n",
    "    #折扣率领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #折扣率核销数\n",
    "    pivot=p.DataFrame(data[data['Date'].map(lambda x:str(x) !='nan')].pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received_use'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #折扣率核销率\n",
    "    h_f[prefixs + 'lu_use'] = list(map(lambda x,y: x/y if y!=0 else 0 ,h_f[prefixs + 'received_use'],h_f[prefixs + 'received']))\n",
    "    \n",
    "    #################################日期\n",
    "    keys=['DATE_RECEIVED']\n",
    "    prefixs='history_field_'+'_'.join(keys)+'_'\n",
    "    #当日领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #当日核销数\n",
    "    pivot=p.DataFrame(data[data['Date'].map(lambda x : str(x) !='nan')].pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received_use'}).reset_index()\n",
    "    h_f=p.merge(h_f,pivot,on=keys,how='left')\n",
    "    #当日核销率\n",
    "    h_f[prefixs + 'lu_use'] = list(map(lambda x,y: x/y if y!=0 else 0 ,h_f[prefixs + 'received_use'],h_f[prefixs + 'received']))\n",
    "    \n",
    "    #当日15天内核销的最大距离\n",
    "    pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = max)).rename(columns = {'Distance':prefixs + 'Distance_15_max'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, how ='left', on = keys)\n",
    "    #当日15天内核销的最小距离\n",
    "    pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = min)).rename(columns = {'Distance':prefixs + 'Distance_15_min'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, how ='left', on = keys)\n",
    "    #当日15天内核销的平均距离\n",
    "    pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.mean)).rename(columns = {'Distance':prefixs + 'Distance_15_mean'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, how ='left', on = keys)\n",
    "    #当日15天内核销的中位距离\n",
    "    pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.median)).rename(columns = {'Distance':prefixs + 'Distance_15_median'}).reset_index()\n",
    "    h_f = p.merge(h_f, pivot, how ='left', on = keys)\n",
    "    #用户距离正反排序\n",
    "    h_f['label_User_distance_true_rank']=h_f.groupby('User_id')['Distance'].rank(ascending=True)\n",
    "    h_f['label_User_distance_False_rank']=h_f.groupby('User_id')['Distance'].rank(ascending=False)  \n",
    "    \n",
    "    #用户折扣正反排序\n",
    "    h_f['label_User_discount_rate_true_rank']=h_f.groupby('User_id')['DISCOUNT'].rank(ascending=True)\n",
    "    h_f['label_User_discount_rate_False_rank']=h_f.groupby('User_id')['DISCOUNT'].rank(ascending=False)\n",
    "  \n",
    "    #用户领券日期正反排序\n",
    "    h_f['label_User_date_received_true_rank']=h_f.groupby('User_id')['DATE_RECEIVED'].rank(ascending=True)\n",
    "    h_f['label_User_date_received_False_rank']=h_f.groupby('User_id')['DATE_RECEIVED'].rank(ascending=False)\n",
    "    \n",
    "    \n",
    "    \n",
    "    ####\n",
    "    #商家距离正反排序\n",
    "    h_f['label_Merchant_distance_true_rank']=h_f.groupby('Merchant_id')['Distance'].rank(ascending=True)\n",
    "    h_f['label_Merchant_distance_False_rank']=h_f.groupby('Merchant_id')['Distance'].rank(ascending=False)  \n",
    "    \n",
    "    #商家折扣正反排序\n",
    "    h_f['label_Merchant_discount_rate_true_rank']=h_f.groupby('Merchant_id')['DISCOUNT'].rank(ascending=True)\n",
    "    h_f['label_Merchant_discount_rate_False_rank']=h_f.groupby('Merchant_id')['DISCOUNT'].rank(ascending=False)\n",
    "  \n",
    "    #商家领券日期正反排序\n",
    "    h_f['label_Merchant_date_received_true_rank']=h_f.groupby('Merchant_id')['DATE_RECEIVED'].rank(ascending=True)\n",
    "    h_f['label_Merchant_date_received_False_rank']=h_f.groupby('Merchant_id')['DATE_RECEIVED'].rank(ascending=False)\n",
    "    \n",
    "    #####\n",
    "    \n",
    "    ############################################~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
    "    #优惠券距离正反排序\n",
    "    h_f['label_Coupon_distance_true_rank']=h_f.groupby('Coupon_id')['Distance'].rank(ascending=True)\n",
    "    h_f['label_Coupon_distance_False_rank']=h_f.groupby('Coupon_id')['Distance'].rank(ascending=False)  \n",
    "    \n",
    "    #优惠券折扣正反排序\n",
    "    h_f['label_Coupon_discount_rate_true_rank']=h_f.groupby('Coupon_id')['DISCOUNT'].rank(ascending=True)\n",
    "    h_f['label_Coupon_discount_rate_False_rank']=h_f.groupby('Coupon_id')['DISCOUNT'].rank(ascending=False)\n",
    "  \n",
    "    #优惠券领券日期正反排序\n",
    "    h_f['label_Coupon_date_received_true_rank']=h_f.groupby('Coupon_id')['DATE_RECEIVED'].rank(ascending=True)\n",
    "    h_f['label_Coupon_date_received_False_rank']=h_f.groupby('Coupon_id')['DATE_RECEIVED'].rank(ascending=False)\n",
    "    \n",
    "    \n",
    "    \n",
    "    h_f.fillna(0,downcast='infer',inplace=True)\n",
    "    return h_f  \n",
    "def get_label_f(label):\n",
    "    data=label.copy()\n",
    "    data['Coupon_id']=data['Coupon_id'].map(int)\n",
    "    data['Date_received']=data['Date_received'].map(int)\n",
    "    l_f= label.copy()\n",
    "    ###################################用户\n",
    "    keys=['User_id']\n",
    "    prefixs='label_field_'+'_'.join(keys)+'_'\n",
    "    #每个用户领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    l_f=p.merge(l_f,pivot,on=keys,how='left')\n",
    "    \n",
    "    \n",
    "    #用户领券的最大距离\n",
    "    pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = max)).rename(columns = {'Distance': prefixs + \"Distance_max\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户领券的最小距离\n",
    "    pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = min)).rename(columns = {'Distance': prefixs + \"Distance_min\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户领券的最小距离\n",
    "    pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.mean)).rename(columns = {'Distance': prefixs + \"Distance_aver\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户领券的最小距离\n",
    "    pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.median)).rename(columns = {'Distance': prefixs + \"Distance_median\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户优惠券折扣率最大值\n",
    "    pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = max)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_max'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户优惠券折扣率最小值\n",
    "    pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = min)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_min'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户优惠券折扣率平均数\n",
    "    pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.mean)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_mean'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户优惠券折扣率中位数\n",
    "    pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.median)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_median'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户领满减券最低消费最大值\n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户领满减券最低消费最小值 \n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户领满减券最低消费平均数 \n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户领满减券最低消费中位数\n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_median'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户领满减券减额最大值\n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户领满减券减额最小值\n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户领满减券减额平均值\n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户领满减券减额中位数\n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    \n",
    "    tmp = data[keys+['DATE_RECEIVED']].sort_values(['DATE_RECEIVED'],ascending=True)\n",
    "    #用户第一次领券\n",
    "    first = tmp.drop_duplicates(keys,keep=\"first\")\n",
    "    first[prefixs+\"is_first_received\"]=1\n",
    "    l_f = p.merge(l_f,first,on=keys+['DATE_RECEIVED'],how=\"left\")\n",
    "    #用户最后一次领券\n",
    "    last = tmp.drop_duplicates(keys,keep=\"last\")\n",
    "    last[prefixs+\"is_last_received\"] = 1\n",
    "    l_f = p.merge(l_f,last,on=keys+['DATE_RECEIVED'],how=\"left\")\n",
    "    #################################用户+商家\n",
    "    keys=['User_id','Merchant_id']\n",
    "    prefixs='label_field_'+'_'.join(keys)+'_'\n",
    "    #用户+商家领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    l_f=p.merge(l_f,pivot,on=keys,how='left')\n",
    "    #用户+商家优惠券折扣率最大值\n",
    "    pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = max)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_max'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户+商家优惠券折扣率最小值\n",
    "    pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = min)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_min'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户+商家优惠券折扣率平均数\n",
    "    pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.mean)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_mean'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户+商家优惠券折扣率中位数\n",
    "    pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.median)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_median'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户+商家领满减券最低消费最大值\n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户+商家领满减券最低消费最小值 \n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户+商家领满减券最低消费平均数 \n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户+商家领满减券最低消费中位数\n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_median'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户+商家领满减券减额最大值\n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户+商家领满减券减额最小值\n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户+商家领满减券减额平均值\n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #用户+商家领满减券减额中位数\n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    tmp = data[keys+['DATE_RECEIVED']].sort_values(['DATE_RECEIVED'],ascending=True)\n",
    "    #用户+商家第一次领券\n",
    "    first = tmp.drop_duplicates(keys,keep=\"first\")\n",
    "    first[prefixs+\"is_first_received\"]=1\n",
    "    l_f = p.merge(l_f,first,on=keys+['DATE_RECEIVED'],how=\"left\")\n",
    "    #用户+商家最后一次领券\n",
    "    last = tmp.drop_duplicates(keys,keep=\"last\")\n",
    "    last[prefixs+\"is_last_received\"] = 1\n",
    "    l_f = p.merge(l_f,last,on=keys+['DATE_RECEIVED'],how=\"left\")\n",
    "    #################################用户+优惠券\n",
    "    keys=['User_id','Coupon_id']\n",
    "    prefixs='label_field_'+'_'.join(keys)+'_'\n",
    "    #用户+优惠券领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    l_f=p.merge(l_f,pivot,on=keys,how='left')\n",
    "    #################################用户+折扣率\n",
    "    keys=['User_id','DISCOUNT']\n",
    "    prefixs='label_field_'+'_'.join(keys)+'_'\n",
    "    #用户+折扣率领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    l_f=p.merge(l_f,pivot,on=keys,how='left')\n",
    "    \n",
    "    tmp = data[keys+['DATE_RECEIVED']].sort_values(['DATE_RECEIVED'],ascending=True)\n",
    "    #用户+折扣率第一次领券\n",
    "    first = tmp.drop_duplicates(keys,keep=\"first\")\n",
    "    first[prefixs+\"is_first_received\"]=1\n",
    "    l_f = p.merge(l_f,first,on=keys+['DATE_RECEIVED'],how=\"left\")\n",
    "    #用户+折扣率最后一次领券\n",
    "    last = tmp.drop_duplicates(keys,keep=\"last\")\n",
    "    last[prefixs+\"is_last_received\"] = 1\n",
    "    l_f = p.merge(l_f,last,on=keys+['DATE_RECEIVED'],how=\"left\")\n",
    "    #################################用户+日期\n",
    "    keys=['User_id','DATE_RECEIVED']\n",
    "    prefixs='label_field_'+'_'.join(keys)+'_'\n",
    "    #用户+日期领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    l_f=p.merge(l_f,pivot,on=keys,how='left')\n",
    "    #################################用户+商家+优惠券\n",
    "    keys=['User_id','Merchant_id','Coupon_id']\n",
    "    prefixs='label_field_'+'_'.join(keys)+'_'\n",
    "    #用户+商家+优惠券领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    l_f=p.merge(l_f,pivot,on=keys,how='left')\n",
    "    #################################用户+商家+日期\n",
    "    keys=['User_id','Merchant_id','DATE_RECEIVED']\n",
    "    prefixs='label_field_'+'_'.join(keys)+'_'\n",
    "    #用户+商家+日期领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    l_f=p.merge(l_f,pivot,on=keys,how='left')\n",
    "    #################################用户+优惠券+日期\n",
    "    keys=['User_id','Coupon_id','DATE_RECEIVED']\n",
    "    prefixs='label_field_'+'_'.join(keys)+'_'\n",
    "    #用户+优惠券+日期领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    l_f=p.merge(l_f,pivot,on=keys,how='left')\n",
    "    #################################商家\n",
    "    keys=['Merchant_id']\n",
    "    prefixs='label_field_'+'_'.join(keys)+'_'\n",
    "    #商家被领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    l_f=p.merge(l_f,pivot,on=keys,how='left')\n",
    "    #商家被领券的最大距离\n",
    "    pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = max)).rename(columns = {'Distance': prefixs + \"Distance_max\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #商家被领券的最小距离\n",
    "    pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = min)).rename(columns = {'Distance': prefixs + \"Distance_min\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #商家被领券的最小距离\n",
    "    pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.mean)).rename(columns = {'Distance': prefixs + \"Distance_aver\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #商家被领券的最小距离\n",
    "    pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.median)).rename(columns = {'Distance': prefixs + \"Distance_median\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #商家优惠券折扣率最大值\n",
    "    pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = max)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_max'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #商家优惠券折扣率最小值\n",
    "    pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = min)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_min'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #商家优惠券折扣率平均数\n",
    "    pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.mean)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_mean'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #商家优惠券折扣率中位数\n",
    "    pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.median)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_median'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #商家被领满减券最低消费最大值\n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #商家被领满减券最低消费最小值 \n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #商家被领满减券最低消费平均数 \n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #商家被领满减券最低消费中位数\n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_median'}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #商家被领满减券减额最大值\n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #商家被领满减券减额最小值\n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #商家被领满减券减额平均值\n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #商家被领满减券减额中位数\n",
    "    pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    tmp = data[keys+['DATE_RECEIVED']].sort_values(['DATE_RECEIVED'],ascending=True)\n",
    "    #商家被第一次领券\n",
    "    first = tmp.drop_duplicates(keys,keep=\"first\")\n",
    "    first[prefixs+\"is_first_received\"]=1\n",
    "    l_f = p.merge(l_f,first,on=keys+['DATE_RECEIVED'],how=\"left\")\n",
    "    #商家被最后一次领券\n",
    "    last = tmp.drop_duplicates(keys,keep=\"last\")\n",
    "    last[prefixs+\"is_last_received\"] = 1\n",
    "    l_f = p.merge(l_f,last,on=keys+['DATE_RECEIVED'],how=\"left\")\n",
    "    #################################商家+优惠券\n",
    "    keys=['Merchant_id','Coupon_id']\n",
    "    prefixs='label_field_'+'_'.join(keys)+'_'\n",
    "    #商家+优惠券领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    l_f=p.merge(l_f,pivot,on=keys,how='left')\n",
    "    \n",
    "    #################################商家+折扣率\n",
    "    keys=['Merchant_id','DISCOUNT']\n",
    "    prefixs='label_field_'+'_'.join(keys)+'_'\n",
    "    #商家+折扣率领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    l_f=p.merge(l_f,pivot,on=keys,how='left')\n",
    "    \n",
    "    tmp = data[keys+['DATE_RECEIVED']].sort_values(['DATE_RECEIVED'],ascending=True)\n",
    "    #商家+折扣率第一次领券\n",
    "    first = tmp.drop_duplicates(keys,keep=\"first\")\n",
    "    first[prefixs+\"is_first_received\"]=1\n",
    "    l_f = p.merge(l_f,first,on=keys+['DATE_RECEIVED'],how=\"left\")\n",
    "    #商家+折扣率最后一次领券\n",
    "    last = tmp.drop_duplicates(keys,keep=\"last\")\n",
    "    last[prefixs+\"is_last_received\"] = 1\n",
    "    l_f = p.merge(l_f,last,on=keys+['DATE_RECEIVED'],how=\"left\")\n",
    "    #################################商家+日期\n",
    "    keys=['Merchant_id','DATE_RECEIVED']\n",
    "    prefixs='label_field_'+'_'.join(keys)+'_'\n",
    "    #商家+日期领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    l_f=p.merge(l_f,pivot,on=keys,how='left')\n",
    "    #################################商家+优惠券+日期\n",
    "    keys=['Merchant_id','Coupon_id','DATE_RECEIVED']\n",
    "    prefixs='label_field_'+'_'.join(keys)+'_'\n",
    "    #商家+优惠券+日期领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    l_f=p.merge(l_f,pivot,on=keys,how='left')\n",
    "    #################################优惠券\n",
    "    keys=['Coupon_id']\n",
    "    prefixs='label_field_'+'_'.join(keys)+'_'\n",
    "    #优惠券领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    l_f=p.merge(l_f,pivot,on=keys,how='left')\n",
    "    \n",
    "    #优惠券被领券的最大距离\n",
    "    pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = max)).rename(columns = {'Distance': prefixs + \"Distance_max\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #优惠券被领券的最小距离\n",
    "    pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = min)).rename(columns = {'Distance': prefixs + \"Distance_min\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #优惠券被领券的最小距离\n",
    "    pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.mean)).rename(columns = {'Distance': prefixs + \"Distance_aver\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #优惠券被领券的最小距离\n",
    "    pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.median)).rename(columns = {'Distance': prefixs + \"Distance_median\"}).reset_index()\n",
    "    l_f = p.merge(l_f, pivot, on = keys, how = 'left')\n",
    "    #################################优惠券+日期\n",
    "    keys=['Coupon_id','DATE_RECEIVED']\n",
    "    prefixs='label_field_'+'_'.join(keys)+'_'\n",
    "    #优惠券+日期领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    l_f=p.merge(l_f,pivot,on=keys,how='left')\n",
    "    #################################折扣率\n",
    "    keys=['DISCOUNT']\n",
    "    prefixs='label_field_'+'_'.join(keys)+'_'\n",
    "    #折扣率 被领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    l_f=p.merge(l_f,pivot,on=keys,how='left')\n",
    "    tmp = data[keys+['DATE_RECEIVED']].sort_values(['DATE_RECEIVED'],ascending=True)\n",
    "    #折扣率 被第一次领券\n",
    "    first = tmp.drop_duplicates(keys,keep=\"first\")\n",
    "    first[prefixs+\"is_first_received\"]=1\n",
    "    l_f = p.merge(l_f,first,on=keys+['DATE_RECEIVED'],how=\"left\")\n",
    "    #折扣率 被最后一次领券\n",
    "    last = tmp.drop_duplicates(keys,keep=\"last\")\n",
    "    last[prefixs+\"is_last_received\"] = 1\n",
    "    l_f = p.merge(l_f,last,on=keys+['DATE_RECEIVED'],how=\"left\")\n",
    "    #################################日期\n",
    "    keys=['DATE_RECEIVED']\n",
    "    prefixs='label_field_'+'_'.join(keys)+'_'\n",
    "    #当日领券数\n",
    "    pivot=p.DataFrame(data.pivot_table(index=keys,values='num',aggfunc=len)).rename(columns={'num':prefixs+'received'}).reset_index()\n",
    "    l_f=p.merge(l_f,pivot,on=keys,how='left')\n",
    "    \n",
    "    \n",
    "    #用户距离正反排序\n",
    "    l_f['label_User_distance_true_rank']=l_f.groupby('User_id')['Distance'].rank(ascending=True)\n",
    "    l_f['label_User_distance_False_rank']=l_f.groupby('User_id')['Distance'].rank(ascending=False)  \n",
    "    \n",
    "    #用户折扣正反排序\n",
    "    l_f['label_User_discount_rate_true_rank']=l_f.groupby('User_id')['DISCOUNT'].rank(ascending=True)\n",
    "    l_f['label_User_discount_rate_False_rank']=l_f.groupby('User_id')['DISCOUNT'].rank(ascending=False)\n",
    "  \n",
    "    \n",
    "    \n",
    "    \n",
    "    ####\n",
    "    #商家距离正反排序\n",
    "    l_f['label_Merchant_distance_true_rank']=l_f.groupby('Merchant_id')['Distance'].rank(ascending=True)\n",
    "    l_f['label_Merchant_distance_False_rank']=l_f.groupby('Merchant_id')['Distance'].rank(ascending=False)  \n",
    "    \n",
    "    #商家折扣正反排序\n",
    "    l_f['label_Merchant_discount_rate_true_rank']=l_f.groupby('Merchant_id')['DISCOUNT'].rank(ascending=True)\n",
    "    l_f['label_Merchant_discount_rate_False_rank']=l_f.groupby('Merchant_id')['DISCOUNT'].rank(ascending=False)\n",
    "\n",
    "    #####\n",
    "    \n",
    "    ############################################~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
    "    #优惠券距离正反排序\n",
    "    l_f['label_Coupon_distance_true_rank']=l_f.groupby('Coupon_id')['Distance'].rank(ascending=True)\n",
    "    l_f['label_Coupon_distance_False_rank']=l_f.groupby('Coupon_id')['Distance'].rank(ascending=False)  \n",
    "    \n",
    "    #优惠券折扣正反排序\n",
    "    l_f['label_Coupon_discount_rate_true_rank']=l_f.groupby('Coupon_id')['DISCOUNT'].rank(ascending=True)\n",
    "    l_f['label_Coupon_discount_rate_False_rank']=l_f.groupby('Coupon_id')['DISCOUNT'].rank(ascending=False)\n",
    "  \n",
    "    #优惠券领券日期正反排序\n",
    "    l_f['label_Coupon_date_received_true_rank']=l_f.groupby('Coupon_id')['DATE_RECEIVED'].rank(ascending=True)\n",
    "    l_f['label_Coupon_date_received_False_rank']=l_f.groupby('Coupon_id')['DATE_RECEIVED'].rank(ascending=False)\n",
    "    \n",
    "    \n",
    "    l_f.fillna(0,downcast='infer',inplace=True)\n",
    "    return l_f\n",
    "\n",
    "def model_xgb(train,test):\n",
    "    params={\n",
    "              \"booster\": 'gbtree',\n",
    "              'objective': 'binary:logistic',\n",
    "              'eval_metric': 'auc',\n",
    "              'silent': 0,#(静默模式,1开0关)\n",
    "              'eta': 0.01,#(0.01~0.2,,,0.01)\n",
    "              'max_depth': 5,#(3~10,,,6)\n",
    "              'min_child_weight': 1,\n",
    "              'gamma': 0,\n",
    "              'lambda': 1,\n",
    "              'colsample_bylevel': 0.7,#(作用与subsample相似)\n",
    "              'colsample_bytree': 0.7,#(0.5~1)\n",
    "              'subsample': 0.9,#(0.5~1)\n",
    "              'scale_pos_weight': 1,#(算法更快收敛)\n",
    "        }\n",
    "    #数据集\n",
    "    dtrain=xgb.DMatrix(train.drop(['User_id','Coupon_id','Merchant_id', 'Discount_rate', 'Date', 'DATE_RECEIVED','Date_received','label','DATE'],axis=1),label=train['label'])\n",
    "    dtest=xgb.DMatrix(test.drop(['User_id','Coupon_id','Merchant_id', 'Discount_rate',  'DATE_RECEIVED','Date_received'],axis=1))\n",
    "    #训练\n",
    "    watchlist=[(dtrain,'train')]\n",
    "    model=xgb.train(params,dtrain,3,watchlist)\n",
    "    #1300轮\n",
    "    #预测\n",
    "    predict=model.predict(dtest)\n",
    "    #结果\n",
    "    predict=p.DataFrame(predict,columns=['prob'])\n",
    "    result=p.concat([test[['User_id','Coupon_id','Date_received']],predict],axis=1)\n",
    "    #特征的重要性\n",
    "    feat_importance = p.DataFrame(columns=['feature_name', 'importance'])\n",
    "    feat_importance['feature_name'] = model.get_score().keys()\n",
    "    feat_importance['importance'] = model.get_score().values()\n",
    "    feat_importance.sort_values(['importance'], ascending=False, inplace=True)\n",
    "    return result,feat_importance \n",
    "\n",
    "if __name__ =='__main__':\n",
    "    #原数据\n",
    "    raw_train=p.read_csv(\"ccf_offline_stage1_train.csv\")\n",
    "    raw_test=p.read_csv(\"ccf_offline_stage1_test_revised.csv\")\n",
    "    #预处理\n",
    "    prepr_train=prepr(raw_train)\n",
    "    prepr_test=prepr(raw_test)\n",
    "    #划分区间\n",
    "    #训练集 历史，中间，标签区间\n",
    "    train_history=prepr_train[prepr_train['DATE_RECEIVED'].isin(p.date_range('2016/3/2',periods=60))]\n",
    "    train_label=prepr_train[prepr_train['DATE_RECEIVED'].isin(p.date_range('2016/5/16',periods=31))]\n",
    "    #验证集 历史，中间，标签区间\n",
    "    verification_history=prepr_train[prepr_train['DATE_RECEIVED'].isin(p.date_range('2016/1/16',periods=60))]\n",
    "    verification_label=prepr_train[prepr_train['DATE_RECEIVED'].isin(p.date_range('2016/3/31',periods=31))]\n",
    "    #测试集 历史，中间，标签区间\n",
    "    test_history=prepr_train[prepr_train['DATE_RECEIVED'].isin(p.date_range('2016/4/17',periods=60))]\n",
    "    test_label=prepr_test.copy()\n",
    "    #构造数据集\n",
    "    complete_train=construct_data(train_history,train_label)\n",
    "    complete_verification=construct_data(verification_history,verification_label)\n",
    "    complete_test=construct_data(test_history,test_label)\n",
    "    good_train=p.concat([complete_train,complete_verification],axis=0)\n",
    "    \n",
    "    \n",
    "    result,feat_importance=model_xgb(good_train,complete_test)\n",
    "    result.to_csv(\"10-17-2.csv\",index=False,header=None)\n"
   ],
   "id": "ce28273222f8849b",
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:457: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = max)).rename(columns = {'Distance': prefixs + \"Distance_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:460: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = min)).rename(columns = {'Distance': prefixs + \"Distance_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:463: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.mean)).rename(columns = {'Distance': prefixs + \"Distance_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:466: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.median)).rename(columns = {'Distance': prefixs + \"Distance_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:469: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = max)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:472: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = min)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:475: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.mean)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_mean'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:478: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.median)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:481: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:484: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:487: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:490: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:493: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:496: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:499: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:502: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:508: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  first[prefixs+\"is_first_received\"]=1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:512: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  last[prefixs+\"is_last_received\"] = 1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:521: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = max)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:524: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = min)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:527: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.mean)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_mean'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:530: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.median)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:533: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:536: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:539: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:542: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:545: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:548: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:551: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:554: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:559: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  first[prefixs+\"is_first_received\"]=1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:563: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  last[prefixs+\"is_last_received\"] = 1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:581: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  first[prefixs+\"is_first_received\"]=1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:585: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  last[prefixs+\"is_last_received\"] = 1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:618: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = max)).rename(columns = {'Distance': prefixs + \"Distance_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:621: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = min)).rename(columns = {'Distance': prefixs + \"Distance_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:624: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.mean)).rename(columns = {'Distance': prefixs + \"Distance_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:627: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.median)).rename(columns = {'Distance': prefixs + \"Distance_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:630: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = max)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:633: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = min)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:636: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.mean)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_mean'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:639: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.median)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:642: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:645: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:648: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:651: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:654: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:657: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:660: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:663: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:668: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  first[prefixs+\"is_first_received\"]=1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:672: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  last[prefixs+\"is_last_received\"] = 1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:691: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  first[prefixs+\"is_first_received\"]=1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:695: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  last[prefixs+\"is_last_received\"] = 1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:717: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = max)).rename(columns = {'Distance': prefixs + \"Distance_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:720: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = min)).rename(columns = {'Distance': prefixs + \"Distance_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:723: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.mean)).rename(columns = {'Distance': prefixs + \"Distance_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:726: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.median)).rename(columns = {'Distance': prefixs + \"Distance_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:743: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  first[prefixs+\"is_first_received\"]=1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:747: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  last[prefixs+\"is_last_received\"] = 1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:793: FutureWarning: The 'downcast' keyword in fillna is deprecated and will be removed in a future version. Use res.infer_objects(copy=False) to infer non-object dtype, or pd.to_numeric with the 'downcast' keyword to downcast numeric results.\n",
      "  l_f.fillna(0,downcast='infer',inplace=True)\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:793: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise in a future error of pandas. Value '0' has dtype incompatible with datetime64[ns], please explicitly cast to a compatible dtype first.\n",
      "  l_f.fillna(0,downcast='infer',inplace=True)\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:54: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = max)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:57: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = min)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:60: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.mean)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:63: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.median)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:66: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = max)).rename(columns = {'Distance':prefixs + 'Distance_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:69: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = min)).rename(columns = {'Distance':prefixs + 'Distance_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:72: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.mean)).rename(columns = {'Distance':prefixs + 'Distance_15_mean'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:75: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.median)).rename(columns = {'Distance':prefixs + 'Distance_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:78: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:81: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:84: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:87: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:90: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:93: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:96: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:99: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_medain'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:115: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = max)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:118: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = min)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:121: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.mean)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:124: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.median)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:127: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:130: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:133: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:136: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:139: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:142: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:145: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:148: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_medain'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:231: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = max)).rename(columns = {'Distance':prefixs + 'Distance_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:234: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = min)).rename(columns = {'Distance':prefixs + 'Distance_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:237: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.mean)).rename(columns = {'Distance':prefixs + 'Distance_15_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:240: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.median)).rename(columns = {'Distance':prefixs + 'Distance_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:243: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = max)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:246: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = min)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:249: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.mean)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:252: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.median)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:255: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:258: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:261: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:264: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:267: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:270: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:273: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:276: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_medain'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:338: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = max)).rename(columns = {'Distance':prefixs + 'Distance_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:341: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = min)).rename(columns = {'Distance':prefixs + 'Distance_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:344: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.mean)).rename(columns = {'Distance':prefixs + 'Distance_15_mean'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:347: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.median)).rename(columns = {'Distance':prefixs + 'Distance_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:386: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = max)).rename(columns = {'Distance':prefixs + 'Distance_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:389: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = min)).rename(columns = {'Distance':prefixs + 'Distance_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:392: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.mean)).rename(columns = {'Distance':prefixs + 'Distance_15_mean'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:395: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.median)).rename(columns = {'Distance':prefixs + 'Distance_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:441: FutureWarning: The 'downcast' keyword in fillna is deprecated and will be removed in a future version. Use res.infer_objects(copy=False) to infer non-object dtype, or pd.to_numeric with the 'downcast' keyword to downcast numeric results.\n",
      "  h_f.fillna(0,downcast='infer',inplace=True)\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:441: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise in a future error of pandas. Value '0' has dtype incompatible with datetime64[ns], please explicitly cast to a compatible dtype first.\n",
      "  h_f.fillna(0,downcast='infer',inplace=True)\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:457: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = max)).rename(columns = {'Distance': prefixs + \"Distance_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:460: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = min)).rename(columns = {'Distance': prefixs + \"Distance_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:463: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.mean)).rename(columns = {'Distance': prefixs + \"Distance_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:466: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.median)).rename(columns = {'Distance': prefixs + \"Distance_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:469: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = max)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:472: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = min)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:475: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.mean)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_mean'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:478: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.median)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:481: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:484: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:487: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:490: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:493: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:496: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:499: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:502: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:508: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  first[prefixs+\"is_first_received\"]=1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:512: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  last[prefixs+\"is_last_received\"] = 1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:521: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = max)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:524: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = min)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:527: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.mean)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_mean'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:530: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.median)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:533: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:536: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:539: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:542: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:545: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:548: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:551: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:554: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:559: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  first[prefixs+\"is_first_received\"]=1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:563: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  last[prefixs+\"is_last_received\"] = 1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:581: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  first[prefixs+\"is_first_received\"]=1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:585: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  last[prefixs+\"is_last_received\"] = 1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:618: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = max)).rename(columns = {'Distance': prefixs + \"Distance_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:621: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = min)).rename(columns = {'Distance': prefixs + \"Distance_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:624: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.mean)).rename(columns = {'Distance': prefixs + \"Distance_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:627: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.median)).rename(columns = {'Distance': prefixs + \"Distance_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:630: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = max)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:633: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = min)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:636: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.mean)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_mean'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:639: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.median)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:642: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:645: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:648: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:651: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:654: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:657: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:660: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:663: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:668: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  first[prefixs+\"is_first_received\"]=1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:672: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  last[prefixs+\"is_last_received\"] = 1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:691: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  first[prefixs+\"is_first_received\"]=1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:695: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  last[prefixs+\"is_last_received\"] = 1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:717: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = max)).rename(columns = {'Distance': prefixs + \"Distance_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:720: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = min)).rename(columns = {'Distance': prefixs + \"Distance_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:723: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.mean)).rename(columns = {'Distance': prefixs + \"Distance_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:726: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.median)).rename(columns = {'Distance': prefixs + \"Distance_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:743: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  first[prefixs+\"is_first_received\"]=1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:747: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  last[prefixs+\"is_last_received\"] = 1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:793: FutureWarning: The 'downcast' keyword in fillna is deprecated and will be removed in a future version. Use res.infer_objects(copy=False) to infer non-object dtype, or pd.to_numeric with the 'downcast' keyword to downcast numeric results.\n",
      "  l_f.fillna(0,downcast='infer',inplace=True)\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:793: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise in a future error of pandas. Value '0' has dtype incompatible with datetime64[ns], please explicitly cast to a compatible dtype first.\n",
      "  l_f.fillna(0,downcast='infer',inplace=True)\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:54: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = max)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:57: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = min)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:60: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.mean)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:63: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.median)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:66: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = max)).rename(columns = {'Distance':prefixs + 'Distance_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:69: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = min)).rename(columns = {'Distance':prefixs + 'Distance_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:72: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.mean)).rename(columns = {'Distance':prefixs + 'Distance_15_mean'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:75: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.median)).rename(columns = {'Distance':prefixs + 'Distance_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:78: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:81: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:84: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:87: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:90: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:93: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:96: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:99: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_medain'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:115: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = max)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:118: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = min)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:121: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.mean)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:124: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.median)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:127: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:130: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:133: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:136: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:139: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:142: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:145: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:148: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_medain'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:231: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = max)).rename(columns = {'Distance':prefixs + 'Distance_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:234: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = min)).rename(columns = {'Distance':prefixs + 'Distance_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:237: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.mean)).rename(columns = {'Distance':prefixs + 'Distance_15_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:240: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.median)).rename(columns = {'Distance':prefixs + 'Distance_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:243: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = max)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:246: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = min)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:249: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.mean)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:252: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.median)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:255: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:258: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:261: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:264: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:267: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:270: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:273: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:276: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_medain'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:338: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = max)).rename(columns = {'Distance':prefixs + 'Distance_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:341: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = min)).rename(columns = {'Distance':prefixs + 'Distance_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:344: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.mean)).rename(columns = {'Distance':prefixs + 'Distance_15_mean'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:347: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.median)).rename(columns = {'Distance':prefixs + 'Distance_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:386: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = max)).rename(columns = {'Distance':prefixs + 'Distance_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:389: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = min)).rename(columns = {'Distance':prefixs + 'Distance_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:392: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.mean)).rename(columns = {'Distance':prefixs + 'Distance_15_mean'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:395: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.median)).rename(columns = {'Distance':prefixs + 'Distance_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:441: FutureWarning: The 'downcast' keyword in fillna is deprecated and will be removed in a future version. Use res.infer_objects(copy=False) to infer non-object dtype, or pd.to_numeric with the 'downcast' keyword to downcast numeric results.\n",
      "  h_f.fillna(0,downcast='infer',inplace=True)\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:441: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise in a future error of pandas. Value '0' has dtype incompatible with datetime64[ns], please explicitly cast to a compatible dtype first.\n",
      "  h_f.fillna(0,downcast='infer',inplace=True)\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:457: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = max)).rename(columns = {'Distance': prefixs + \"Distance_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:460: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = min)).rename(columns = {'Distance': prefixs + \"Distance_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:463: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.mean)).rename(columns = {'Distance': prefixs + \"Distance_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:466: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.median)).rename(columns = {'Distance': prefixs + \"Distance_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:469: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = max)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:472: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = min)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:475: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.mean)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_mean'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:478: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.median)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:481: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:484: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:487: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:490: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:493: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:496: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:499: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:502: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:508: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  first[prefixs+\"is_first_received\"]=1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:512: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  last[prefixs+\"is_last_received\"] = 1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:521: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = max)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:524: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = min)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:527: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.mean)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_mean'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:530: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.median)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:533: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:536: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:539: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:542: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:545: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:548: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:551: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:554: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:559: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  first[prefixs+\"is_first_received\"]=1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:563: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  last[prefixs+\"is_last_received\"] = 1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:581: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  first[prefixs+\"is_first_received\"]=1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:585: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  last[prefixs+\"is_last_received\"] = 1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:618: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = max)).rename(columns = {'Distance': prefixs + \"Distance_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:621: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = min)).rename(columns = {'Distance': prefixs + \"Distance_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:624: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.mean)).rename(columns = {'Distance': prefixs + \"Distance_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:627: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.median)).rename(columns = {'Distance': prefixs + \"Distance_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:630: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = max)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:633: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = min)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:636: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.mean)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_mean'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:639: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table( index = keys, values = 'DISCOUNT', aggfunc = n.median)).rename(columns = {'DISCOUNT': prefixs + 'DISCOUNT_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:642: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:645: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:648: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:651: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'MI_COST',aggfunc=n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:654: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:657: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:660: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:663: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['MJ']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:668: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  first[prefixs+\"is_first_received\"]=1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:672: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  last[prefixs+\"is_last_received\"] = 1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:691: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  first[prefixs+\"is_first_received\"]=1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:695: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  last[prefixs+\"is_last_received\"] = 1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:717: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = max)).rename(columns = {'Distance': prefixs + \"Distance_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:720: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = min)).rename(columns = {'Distance': prefixs + \"Distance_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:723: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.mean)).rename(columns = {'Distance': prefixs + \"Distance_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:726: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data.pivot_table(index = keys, values = 'Distance', aggfunc = n.median)).rename(columns = {'Distance': prefixs + \"Distance_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:743: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  first[prefixs+\"is_first_received\"]=1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:747: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  last[prefixs+\"is_last_received\"] = 1\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:793: FutureWarning: The 'downcast' keyword in fillna is deprecated and will be removed in a future version. Use res.infer_objects(copy=False) to infer non-object dtype, or pd.to_numeric with the 'downcast' keyword to downcast numeric results.\n",
      "  l_f.fillna(0,downcast='infer',inplace=True)\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:54: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = max)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:57: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = min)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:60: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.mean)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:63: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.median)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:66: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = max)).rename(columns = {'Distance':prefixs + 'Distance_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:69: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = min)).rename(columns = {'Distance':prefixs + 'Distance_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:72: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.mean)).rename(columns = {'Distance':prefixs + 'Distance_15_mean'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:75: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.median)).rename(columns = {'Distance':prefixs + 'Distance_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:78: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:81: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:84: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:87: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:90: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:93: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:96: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:99: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_medain'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:115: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = max)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:118: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = min)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:121: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.mean)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:124: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.median)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:127: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:130: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:133: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:136: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:139: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:142: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:145: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:148: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_medain'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:231: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = max)).rename(columns = {'Distance':prefixs + 'Distance_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:234: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = min)).rename(columns = {'Distance':prefixs + 'Distance_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:237: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.mean)).rename(columns = {'Distance':prefixs + 'Distance_15_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:240: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.median)).rename(columns = {'Distance':prefixs + 'Distance_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:243: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = max)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:246: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = min)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:249: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.mean)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:252: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table( index = keys, values ='DISCOUNT',aggfunc = n.median)).rename(columns = {'DISCOUNT':prefixs + 'DISCOUNT_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:255: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = max)).rename(columns = {'JIAN': prefixs + \"JIAN_max\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:258: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = min)).rename(columns = {'JIAN': prefixs + \"JIAN_min\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:261: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.mean)).rename(columns = {'JIAN': prefixs + \"JIAN_aver\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:264: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'JIAN', aggfunc = n.median)).rename(columns = {'JIAN': prefixs + \"JIAN_median\"}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:267: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = max)).rename(columns = {'MI_COST': prefixs + 'MI_COST_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:270: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = min)).rename(columns = {'MI_COST': prefixs + 'MI_COST_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:273: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.mean)).rename(columns = {'MI_COST': prefixs + 'MI_COST_aver'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:276: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot = p.DataFrame(data[data['label']==1].pivot_table(index = keys, values = 'MI_COST', aggfunc = n.median)).rename(columns = {'MI_COST': prefixs + 'MI_COST_medain'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:338: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = max)).rename(columns = {'Distance':prefixs + 'Distance_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:341: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = min)).rename(columns = {'Distance':prefixs + 'Distance_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:344: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.mean)).rename(columns = {'Distance':prefixs + 'Distance_15_mean'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:347: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.median)).rename(columns = {'Distance':prefixs + 'Distance_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:386: FutureWarning: The provided callable <built-in function max> is currently using DataFrameGroupBy.max. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"max\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = max)).rename(columns = {'Distance':prefixs + 'Distance_15_max'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:389: FutureWarning: The provided callable <built-in function min> is currently using DataFrameGroupBy.min. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"min\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = min)).rename(columns = {'Distance':prefixs + 'Distance_15_min'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:392: FutureWarning: The provided callable <function mean at 0x0000021B121CD3A0> is currently using DataFrameGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"mean\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.mean)).rename(columns = {'Distance':prefixs + 'Distance_15_mean'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:395: FutureWarning: The provided callable <function median at 0x0000021B12310EA0> is currently using DataFrameGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string \"median\" instead.\n",
      "  pivot =p.DataFrame(data[data['label']==1].pivot_table( index = keys, values = 'Distance',aggfunc = n.median)).rename(columns = {'Distance':prefixs + 'Distance_15_median'}).reset_index()\n",
      "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_1436\\4182821510.py:441: FutureWarning: The 'downcast' keyword in fillna is deprecated and will be removed in a future version. Use res.infer_objects(copy=False) to infer non-object dtype, or pd.to_numeric with the 'downcast' keyword to downcast numeric results.\n",
      "  h_f.fillna(0,downcast='infer',inplace=True)\n",
      "D:\\Anaconda\\Lib\\site-packages\\xgboost\\core.py:723: FutureWarning: Pass `evals` as keyword args.\n",
      "  warnings.warn(msg, FutureWarning)\n",
      "D:\\Anaconda\\Lib\\site-packages\\xgboost\\core.py:158: UserWarning: [21:48:36] WARNING: C:\\b\\abs_90_bwj_86a\\croot\\xgboost-split_1724073762025\\work\\src\\learner.cc:740: \n",
      "Parameters: { \"silent\" } are not used.\n",
      "\n",
      "  warnings.warn(smsg, UserWarning)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0]\ttrain-auc:0.82755\n",
      "[1]\ttrain-auc:0.85006\n",
      "[2]\ttrain-auc:0.85165\n"
     ]
    }
   ],
   "execution_count": 3
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
